/**Filename: scheduler.h
 * Author(s): Vladimir Dudnic, Michael Groenier, Derek Fleener
 * Winter 2013 TCSS422
 * Project 2
 */

#ifndef SCHEDULER_H_
#define SCHEDULER_H_

#include"../process/process.h"
#include"../queue/blockingQueue.h"
#include "../arraylist/blockedList.h"

typedef enum SchedulerType{
  PRIORITY, ROUND_ROBIN, LOTTERY
}SchedulerType;

typedef struct Scheduler{
  SchedulerType type;
  blockingQueue* readyQueue;
  blockingQueue** readyPriorityQueue;
  blockedList* readyArrayQueue;
  Process* (*nextProcess)(struct Scheduler*);
  void (*readyProcess)(struct Scheduler*, Process*);
  pthread_mutex_t* lock;
}Scheduler;

int schedulerInit(Scheduler*, SchedulerType);
Process* nextRoundRobinProcess(Scheduler*);
Process* nextPriorityProcess(Scheduler*);
Process* nextLotteryProcess(Scheduler*);

void readyRoundRobinProcess(Scheduler*,Process*);
void readyPriorityProcess(Scheduler*,Process*);
void readyLotteryProcess(Scheduler*,Process*);
#endif
